From feb8f6988df2a9c85e642bc4949034102d0d8241 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Tue, 31 Mar 2009 17:09:22 +0000 Subject: [PATCH] Support hpux use of shl load/unload and dsos with .sl suffixes Patch from Gary V. Vaughan svn path=/trunk/; revision=404 --- ChangeLog | 11 +++++++ babl/babl-extension.c | 23 +++++++++++++++ configure.ac | 18 +++++------- extensions/.gitignore | 3 +- extensions/Makefile.am | 66 ++++++++++-------------------------------- tests/Makefile.am | 2 +- 6 files changed, 60 insertions(+), 63 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4518937..93c8577 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-03-25 Martin Nordholts + + Patch from Gary V. Vaughan. Support hpux use of shl load/unload + and dsos with .sl suffixes + + * babl/babl-extension.c + * configure.ac + * extensions/Makefile.am + * tests/Makefile.am + 2008-03-27 Kevin Cozens * configure.ac: @@ -32,6 +42,7 @@ * configure.ac 2009-03-25 Martin Nordholts + * babl/babl-fish.c: Patch from Gary V. Vaughan. Some vendor compilers can't compile non-constant elements of compound struct initializers diff --git a/babl/babl-extension.c b/babl/babl-extension.c index 1788bbd..3ba28ae 100644 --- a/babl/babl-extension.c +++ b/babl/babl-extension.c @@ -133,8 +133,31 @@ destroy_hook (void) #include #ifdef HAVE_DLFCN_H + #include #define HLIB void * + +#elif HAVE_DL_H + +#include +#include +#if !defined(DYNAMIC_PATH) +# define DYNAMIC_PATH 0 +#endif +#if !defined(BIND_RESTRICTED) +# define BIND_RESTRICTED 0 +#endif +#define RTLD_NOW (BIND_IMMEDIATE|BIND_NONFATAL|DYNAMIC_PATH) +#define HLIB shl_t +#define dlopen(path, flags) shl_load (path, flags, 0L) +#define dlclose(handle) shl_unload (handle) +#define dlerror() strerror (errno) +static void *dlsym (HLIB handle, const char *name) { + void *address = 0; + shl_findsym(&handle, name, TYPE_UNDEFINED, &address); + return address; +} + #endif #ifndef RTLD_NOW diff --git a/configure.ac b/configure.ac index edb9b80..2acb89e 100644 --- a/configure.ac +++ b/configure.ac @@ -177,22 +177,22 @@ case "$target_or_host" in esac -#################################################### -# Check how to generate plug-ins (with gcc at least) -#################################################### +############################ +# Check how to find plug-ins +############################ AC_MSG_CHECKING([for some Win32 platform]) case "$target_or_host" in *-*-darwin*) # darwin shrext=.dylib - dynamiclib=-dynamiclib + ;; + hppa*-hpux*) # HP/UX + shrext=.sl ;; *-*-mingw* | *-*-cygwin*) # windows shrext=.dll - dynamiclib=-shared ;; *) # linux (and BSD?) - dynamiclib=-shared shrext=.so ;; esac @@ -201,10 +201,6 @@ SHREXT=$shrext AC_SUBST(SHREXT) AC_DEFINE_UNQUOTED(SHREXT, "$shrext", [File extension for shared libraries]) -DYNAMICLIB=$dynamiclib -AC_SUBST(DYNAMICLIB) -AC_DEFINE_UNQUOTED(DYNAMICLIB, "$dynamiclib", [Dynamic shared library]) - dnl =========================================================================== ################# @@ -367,6 +363,8 @@ fi dnl =========================================================================== +AC_CHECK_HEADERS(dl.h) + AC_SEARCH_LIBS([dlopen], [dl]) AC_SEARCH_LIBS([rint], [m]) diff --git a/extensions/.gitignore b/extensions/.gitignore index f34e919..3dff2af 100644 --- a/extensions/.gitignore +++ b/extensions/.gitignore @@ -1,3 +1,4 @@ +/*.so +/.deps /Makefile /Makefile.in -/*.so diff --git a/extensions/Makefile.am b/extensions/Makefile.am index 3b1d2e5..badece7 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -1,61 +1,25 @@ -# General minimalistic compile file for self contained single -# file babl_extensions - if OS_WIN32 -no_undefined = -no-undefined -libbabldlla=$(top_builddir)/babl/.libs/libbabl-$(BABL_API_VERSION).dll.a +AM_LDFLAGS = -module -no-undefined +else +AM_LDFLAGS = -module endif -CFILES = $(wildcard $(srcdir)/*.c) -SOBJS = $(subst $(srcdir)/,,$(CFILES:.c=$(SHREXT))) -INSTALLED_ITEMS = $(subst $(srcdir),$(ext_dir),$(CFILES:.c=$(SHREXT))) -EXTRA_DIST = $(wildcard *.[ch]) - -all-local: $(SOBJS) - AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/babl \ - -I$(top_srcdir)/extensions \ - -fPIC - -LDFLAGS += $(DYNAMICLIB) - -if OS_WIN32 -LDADD = $(no-undefined) $(libbabldlla) $(MATH_LIB) -else -LDADD = $(top_builddir)/babl/.libs/libbabl-$(BABL_API_VERSION)$(SHREXT) $(MATH_LIB) -endif - -%$(SHREXT): %.c - $(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDADD) - -# if extension needing external libraries are to be # compiled with this make -# file, each of them can be added according to the this pattern: -# extra$(SHREXT): extra.c -# $(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< [own compile and link flags] - -CIE-Lab$(SHREXT): CIE-Lab.c - $(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDADD) - -sse-fixups$(SHREXT): sse-fixups.c - $(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(MMX_EXTRA_CFLAGS) $(SSE_EXTRA_CFLAGS) $(LDFLAGS) -o $@ $< $(LDADD) -#lcms$(SHREXT): lcms.c - -# $(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDADD) `pkg-config lcms --cflags --libs` -############################################################################# - -clean-local: - rm -f $(SOBJS) - -ext_dir = $(DESTDIR)$(libdir)/babl-@BABL_API_VERSION@ + -I$(top_srcdir)/extensions -install-exec-local: all-local - $(INSTALL) -d $(ext_dir) - $(INSTALL) $(SOBJS) $(ext_dir) +extdir = $(DESTDIR)$(libdir)/babl-@BABL_API_VERSION@ +ext_LTLIBRARIES = \ + CIE-Lab.la \ + gegl-fixups.la \ + gggl-lies.la \ + gggl.la \ + gimp-8bit.la \ + naive-CMYK.la \ + sse-fixups.la -uninstall-local: - rm -f $(INSTALLED_ITEMS) +LIBS = $(top_builddir)/babl/libbabl-@BABL_API_VERSION@.la $(MATH_LIB) -check-local: all-local +sse_fixups_la_CFLAGS = $(MMX_EXTRA_CFLAGS) $(SSE_EXTRA_CFLAGS) diff --git a/tests/Makefile.am b/tests/Makefile.am index 478ac9a..092f1f9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,7 +8,7 @@ TESTS = \ types \ models -TESTS_ENVIRONMENT = BABL_PATH=$(top_builddir)/extensions +TESTS_ENVIRONMENT = BABL_PATH=$(top_builddir)/extensions/.libs grayscale_to_rgb_SOURCES = grayscale_to_rgb.c rgb_to_bgr_SOURCES = rgb_to_bgr.c -- 2.30.2